home *** CD-ROM | disk | FTP | other *** search
- /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
- /*
- * The contents of this file are subject to the Netscape Public License
- * Version 1.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code,
- * released March 31, 1998.
- *
- * The Initial Developer of the Original Code is Netscape Communications
- * Corporation. Portions created by Netscape are
- * Copyright (C) 1998 Netscape Communications Corporation. All Rights
- * Reserved.
- *
- * Contributors:
- * William A. ("PowerGUI") Law <law@netscape.com>
- */
-
- /* net2Phone
-
- This function is invoked when the user clicks on the Net2Phone personal
- toolbar button, or, the Net2Phone Tasks menu choice.
-
- It accesses the nsINet2Phone service and invokes its "launch" method.
-
- If that fails for any reason (e.g., Net2Phone isn't installed yet)
- then we show the info web page.
- */
- dump( "Net2Phone.js has been interpreted...\n" );
- function net2Phone( n2pURL ) {
- // Get nsINet2Phone component instance.
- var n2pContractId = "@mozilla.org/appshell/component/net2phone;1";
- var n2pIID = Components.interfaces.nsINet2Phone;
- // var n2pURL = "http://home.netscape.com/bookmark/6_1/n2phone.html";
- var n2p = Components.classes[ n2pContractId ].getService( n2pIID );
- if ( n2p ) {
- // Launch it.
- try {
- if( !n2p.launch() ) {
- // Unable to launch (but no error). This means the user
- // has not installed Net2Phone yet. Clue them in by
- // opening the appropriate web page.
- openTopWin( n2pURL );
- }
- } catch ( exception ) {
- // XXX l10n
- alert( "Error launching Net2Phone" );
- }
- } else {
- // XXX l10n
- alert( "Error creating Net2Phone interface component" );
- }
- }
-